<?php


use yii\bootstrap\BootstrapAsset;
use yii\helpers\Html;

BootstrapAsset::register($this);

$this->title = '用户标签';

?>


<section class="wrapper site-min-height">
    <!-- page start-->
    <section class="panel">
        <header class="panel-heading">
            <?= Html::a('返回', 'javascript:history.back(-1)'); ?>  <?= Html::encode($this->title) ?>
        </header>


        <div class="panel-body">
            <div class="adv-table editable-table ">


                <div class="wechat-images-reply-index">
                    <p>
                        <?= Html::a('添加标签', ['create'], ['class' => 'btn btn-success']) ?>
                        <?= Html::button('刷新',['class' => 'refresh btn btn-success']) ?>
                    </p>
                    <div class="row">
                        <div class="col-md-10 col-md-offset-1">
                            <table class="table table-striped">
                                <tr>
                                    <th>
                                        名称
                                    </th>
                                    <th>
                                        人数
                                    </th>
                                    <th>
                                        操作
                                    </th>
                                </tr>
                                <?php foreach ($data as $key => $row) { ?>
                                    <tr>
                                        <td>
                                            <?= $row['name'] ?>
                                        </td>
                                        <td>
                                            <?= $row['count'] ?>
                                        </td>
                                        <td>
                                            <a href="update?tagid=<?=$row['id']?>">更新</a>|
                                            <a href="delete?id=<?=$row['id']?>">删除</a>
                                        </td>
                                    </tr>
                                <?php } ?>
                            </table>
                        </div>
                    </div>
                </div>

            </div>

        </div>
    </section>
</section>


<script>
<?php $this->beginBlock('js') ?>
    $('.refresh').click(function(){
        $.post('refresh',{},function(data){
            alert(data.msg);
            if(data.status==0){
                window.location.href='index';
            }
        },'json');
    })

<?php $this->endBlock('js') ?>
<?php $this->registerJs($this->blocks['js'],\yii\web\View::POS_END) ?>
</script>




